//
// Created by suzhen on 16-11-10.
//

#ifndef ORIONV2_COUNTDOWNLATH_H
#define ORIONV2_COUNTDOWNLATH_H

#include "FutureAdapt.hpp"
#include <cstddef>
#include <vector>

namespace Concurrent {

    class CountDownLath {

    public:
        explicit CountDownLath(std::size_t countTotal);

        void countDown();

        void waitForComplete();

    private:
        std::mutex lock_;
        std::vector<Orion::V2::Promise<int>> promiseVec_;
        std::vector<Orion::V2::Future<int>> futureVec_;
        std::size_t totalCountDown_ = {0};
    };
}


#endif //ORIONV2_COUNTDOWNLATH_H
